home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c,comp.lang.c.moderated
- Subject: Re: const pointer confusion...
- Date: 24 Mar 1996 11:40:23 -0600
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4j41e7$nep@solutions.solon.com>
- References: <4j06gm$7oa@solutions.solon.com>
- NNTP-Posting-Host: solutions.solon.com
-
-
- "Reed R. Mangino" <mangino@planet.net> writes:
-
- >Could someone please straighten me out on this:
-
- >1) const int *p = 10;
- > p is a constant pointer to an int, right? While p can be made to
- > point to something else, *p can never be assigned to, right?
-
- "p" is a pointer to a "const int", and the pointer is in no way constant,
- as you paraphrase correctly.
-
- >2) int *const p;
- > p is a pointer to an integer. *p can be assigned to, but p can
- > never be made to point to another address in memory, right?
-
- So, in this case, "p" is a constant pointer to an int, isn't it?
-
- >3) int const *p;
- > What the heck is this? I can't find anything like this in my
- > books, but my compiler thinks everything is hunky doory!???
-
- "p" is a pointer to an "int const", which happens to be the same as
- a pointer to an "const int".
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-